export default class GameMap {
    constructor(element,speed = 20, src = '/images/background_1.png') {
        this.speed = speed;
        this.src = src;
        this.element = element;
    }
    autoRun() {
        function move() {
            var step = this.speed / 1000 * 20;
            step = step < 1 ? 1 : step;
            var current = parseInt(getComputedStyle(this.element)['backgroundPositionY']);
            current += step;
            this.element.style.backgroundPositionY = current + 'px';
        }
        this.timer = setInterval(move.bind(this), 20);
    }
}